home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / headers / soundclass.h < prev    next >
Encoding:
Text File  |  2000-06-23  |  2.2 KB  |  76 lines

  1. /*
  2.     File:        SoundClass.h
  3.  
  4.     Contains:    TSound is a simple object that plays sounds     
  5.                   TSound.h contains the TSound class definitions. 
  6.  
  7.     Written by: Kent Sandvik    
  8.  
  9.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  10.  
  11.                 You may incorporate this Apple sample source code into your program(s) without
  12.                 restriction. This Apple sample source code has been provided "AS IS" and the
  13.                 responsibility for its operation is yours. You are not permitted to redistribute
  14.                 this Apple sample source code as "Apple sample source code" after having made
  15.                 changes. If you're going to re-distribute the source, we require that you make
  16.                 it clear in the source that the code was descended from Apple sample source
  17.                 code, but that you've made changes.
  18.  
  19.     Change History (most recent first):
  20.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  21.                 
  22.  
  23. */
  24. // Declare label for this header file
  25. #ifndef _SOUND_
  26. #define _SOUND_
  27.  
  28. #ifndef _DTSCPLUSLIBRARY_
  29. #include "DTSCPlusLibrary.h"
  30. #endif
  31.  
  32. #ifndef __RESOURCES__
  33. #include <Resources.h>
  34. #endif
  35.  
  36. #ifndef __SOUND__
  37. #include <Sound.h>
  38. #endif
  39.  
  40. const OSType kSoundType = 'snd ';                // our resource type definition
  41.  
  42.  
  43. // _________________________________________________________________________________________________________ //
  44. //    TSound Class Interface.
  45.  
  46. class TSound
  47. // A simple sound class used for playing sounds synchonously (in future asynch as well).
  48. {
  49. public:
  50.     // CONSTRUCTORS AND DESTRUCTORS
  51.     TSound(char* name);                            // construct an object based on the name of the sound resource
  52.     TSound(short resID);                        // construct an object based on the resource ID
  53.     virtual~ TSound();                            // default destructor
  54.  
  55.     // MAIN INTERFACE
  56.     virtual void Play();                        // play the sound
  57.  
  58.     // FIELDS
  59.     Handle fSoundHandle;                        // handle where the sound resource is stored
  60.     OSErr fError;                                // latest error
  61.     char* fSound;                                // name of the sound wave
  62.     short fSoundID;                                // ID of the sound wave
  63. };
  64.  
  65.  
  66. #endif
  67.  
  68. // _________________________________________________________________________________________________________ //
  69.  
  70.  
  71. /*    Change History (most recent last):
  72.   No        Init.    Date        Comment
  73.   1            khs        12/21/92    New file
  74.   2            khs        1/14/93        Cleanup
  75. */
  76.